Add a spec for the url_on_receive option

Akinori MUSHA 9 years ago
parent
commit
1e336f029e
1 changed files with 11 additions and 0 deletions
  1. 11 0
      spec/models/agents/website_agent_spec.rb

+ 11 - 0
spec/models/agents/website_agent_spec.rb

@@ -633,6 +633,17 @@ fire: hot
633 633
         }.to change { Event.count }.by(1)
634 634
       end
635 635
 
636
+      it "should use url_on_receive as url to scrape if it exists when receiving an event" do
637
+        stub = stub_request(:any, 'http://example.org/?url=http%3A%2F%2Fxkcd.com')
638
+
639
+        @checker.options = @valid_options.merge(
640
+          'url_on_receive' => 'http://example.org/?url={{url | uri_escape}}'
641
+        )
642
+        @checker.receive([@event])
643
+
644
+        expect(stub).to have_been_requested
645
+      end
646
+
636 647
       it "should interpolate values from incoming event payload" do
637 648
         expect {
638 649
           @valid_options['extract'] = {